package com.qin.mall.openfeign.product;

import com.qin.mall.common.api.CommonResult;
import com.qin.mall.common.api.MyBatisPlusPage;
import com.qin.mall.domain.PmsProductCategory;
import com.qin.mall.dto.PmsProductCategoryWithChildrenItem;
import com.qin.mall.dto.ProductCategoryParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 产品分类
 * @author Leisure
 * create 2022 2022/11/19 10:31
 **/
@FeignClient("product-manage")
public interface ProductCategoryFeigin {

    //创建商品分类
    @PostMapping("/productCategory/create$")
    public CommonResult createCategory(@RequestBody ProductCategoryParam productCategoryParam);

    //根据id修改商品 分类
    @PostMapping("/productCategory/update$/{id}")
    public CommonResult updateCategory(@PathVariable Long id,
                                 @RequestBody ProductCategoryParam productCategoryParam);

    //分页获取商品分类
    @GetMapping("/productCategory/list$/{parentId}")
    public CommonResult<MyBatisPlusPage<PmsProductCategory>> getList(@PathVariable Long parentId,
                                                                     @RequestParam(value = "pageSize",defaultValue = "5") Integer pageSize,
                                                                     @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum );
    
    //根据ID获取商品分类
    @GetMapping("/productCategory/$/{id}")
    @ResponseBody
    public CommonResult<PmsProductCategory> selectById(@PathVariable Long id);

    // 根据id删除商品分类
    @PostMapping("/productCategory/delete$/{id}")
    public CommonResult deleteById(@PathVariable Long id);
    
    // 批量修改导航状态
    @PostMapping("/productCategory/update/navStatus$")
    public CommonResult updateNavStatus(@RequestParam("navStatus") Integer navStatus,
                                        @RequestParam("ids") List<Long> ids);

    // 批量修改显示状态
    @PostMapping("/productCategory/update/showStatus$")
    public CommonResult updateShowStatus(@RequestParam("showStatus") Integer showStatus,
                                         @RequestParam("ids") List<Long> ids);

    //以层级形式获取商品分类
    @GetMapping("/productCategory/list/withChildren$")
    public CommonResult<List<PmsProductCategoryWithChildrenItem>> withChildren();






}
